import { createRouter, createWebHistory } from 'vue-router'
import index from '../view/user/index.vue'
// 用户端地图页面
import UserMap from "@/view/map/UserMap.vue";
import MapContainer from "@/view/map/MapContainer.vue";
import { ElMessage } from 'element-plus'
//用户端页面
import profile from "@/view/user/profile.vue";
// 登录相关页面
import login from '../view/login.vue'
import register from '../view/register.vue'
import forgotPassword from '../view/forgotPassword.vue'
import AdminIndex from "@/view/admin/adminIndex.vue";
import AdminList from "@/view/admin/adminList.vue";
import UserList from "@/view/admin/userList.vue";
import Order from "@/view/admin/order.vue";
import Goods from "@/view/admin/goods.vue";
import Shopping from "@/view/user/shopping.vue";
import GoodsList from "@/view/user/goodsList.vue";
import GoodsProfile from "@/view/user/goodsProfile.vue";
import OrderProfile from "@/view/user/orderProfile.vue";
import OrderList from "@/view/user/orderList.vue";
import Payment from "@/view/user/payment.vue";
import PaymentList from "@/view/admin/paymentList.vue";
import ElevenGoods from "@/view/admin/seckill/elevenGoods.vue";



const routes = [
    {
        path: '/login',
        name: 'login',
        component: login
    },
    {
        path: '/admin-login',
        name: 'adminLogin',
        component: login
    },
    {
        path: '/register',
        name: 'register',
        component: register
    },
    {
        path: '/forgot-password',
        name: 'forgotPassword',
        component: forgotPassword
    },
    {
        path:'/',
        name:'index',
        component:index,
        children:[
            {path:'/user/profile',component:profile},
            {path:'/map/UserMap',component:UserMap},
            {path:'/user/shopping',component: Shopping, name: 'shopping' },
            {path:'/user/goods-list',component: GoodsList, name: 'goodsList' },
            {path:'/user/goods-profile/:id',component: GoodsProfile, name: 'goodsProfile', props: true},
            {path:'/user/order-profile/:id',component: OrderProfile, name: 'orderProfile', props: true},
            {path: '/user/orderList',component: OrderList},
            {path: '/user/payment',component: Payment},
        ]
    },
    {
        path:'/admin/adminIndex',
        name:'adminIndex',
        component:AdminIndex,
        children:[
            {path:'/admin/adminList',component:AdminList},
            {path:'/admin/userList',component:UserList},
            {path:'/admin/goods',component:Goods},
            {path:'/admin/order',component:Order},
            {path:'/admin/paymentList',component: PaymentList},
            {path:'/admin/seckill/elevenGoods',component: ElevenGoods},
        ]
    },

]

const router = createRouter({
    history: createWebHistory(),
    routes
})

export default router;
